package com.itheima.功能流.序列化流;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class 对象序列化流 {
    public static void main(String[] args) throws IOException {
        //创建对象
        User user = new User("张三","qwerty");
        //创建对象输出流
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("user.txt"));
        //
        oos.writeObject(user);

        oos.close();
    }
}
